import networkx as nx
import matplotlib.pyplot as plt

# 带权图
G=nx.Graph()
G.add_edge(2,3)
G.add_weighted_edges_from([(3,4,3.5),(3,5,7.0)])

print(G.get_edge_data(2,3))
print(G.get_edge_data(3,4))
nx.draw(G,with_labels=True)
plt.show()